﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using JTicket.BLL;

namespace JTicket.UI
{
    public partial class JT_CompanyManager : RoleBase
    {
        public List<JTicket.Model.C_CompanyInfo> _companyInfo { get; set; }
        private readonly BLL.D_OperInfo bllOper = new BLL.D_OperInfo();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
                Bind();

        }
        void Bind()
        {
            Model.D_OperInfo OperInfo = bllOper.Oper();
            string CurLevel = OperInfo.CurLevel.ToString();//系统级权限
            string ThCode = OperInfo.ThCode;//企业编号
            string kw = string.Empty;//搜索关键字
            int page = 0;
            int pages = 0;
            int len = 30;
            if (!string.IsNullOrEmpty(Request.QueryString["page"]))
            {
                page = int.Parse(Request.QueryString["page"]);
                kw = Request.QueryString["KeyWord"].ToString();
            }
            //判断权限获取数据。
            switch (CurLevel)
            {
                case "0"://系统权限
                    _companyInfo = BLL.C_CompanyInfo.GetList(page, len, ref pages,kw);
                    break;
                default:
                    _companyInfo = BLL.C_CompanyInfo.GetList(page, len, ref pages, kw);
                    break;
            }
            ScriptManager.RegisterStartupScript(
               this, typeof(Page), "pages", string.Format("var page={0};var pages={1};", page, pages), true);
        }
 
    }
}